package cn.weiyang.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * �õ���Ӧ�ı�����
 * @author Administrator
 *
 */
public class BaseAction extends ActionSupport{
	/**
	 * �õ������request
	 * @return
	 */
	public static Map<String,Object> getMapRequest(){
		return (Map<String,Object>)ActionContext.getContext().get("request");
	}
	/**
	 * �õ������session
	 * @return
	 */
	public  static Map<String,Object> getMapSession(){
		return ActionContext.getContext().getSession();
	}
	/**
	 * ��ϵ�request
	 * @return
	 */
	public static HttpServletRequest getRequest(){
		return ServletActionContext.getRequest();
	}
	/**
	 * ��ϵ�session
	 * @return
	 */
	public static HttpSession getSession(){
		return ServletActionContext.getRequest().getSession();
	}
	/**
	 * ��ϵ�response
	 * @return
	 */
	public static HttpServletResponse getResponse(){
		HttpServletResponse response=ServletActionContext.getResponse();
		response.setContentType("text/html;charset=utf-8");
		return response;
	}

}
